Async = require 'async'
Article = require './article'
Reflection = require './reflection'

viewDataHandler = 
  ###*
   * [home description]
   * @param  {[type]} cbf [description]
   * @return {[type]}     [description]
  ###
  home : (cbf) ->
      Async.series
        welcomeDialogContent : (cbf) ->
          Reflection.findOne (err, data) ->
            if err
              cbf err
            else
              cbf null, data
        articlesContent : (cbf) ->
          Article.findAll (err, data) ->
            if err
              cbf err
            else
              cbf null, data
      ,
      (err, results) ->
        cbf err, results

module.exports = viewDataHandler

